<template>
	<view style="padding: 80rpx;">
		<view style="text-align: center;font-size: 60rpx;margin:100rpx 0;">账号注册</view>
		<uv-input class='input' v-model="mobile" maxlength="11" type="tel" prefixIcon="phone" fontSize="32rpx" :prefixIconStyle="{fontSize: '40rpx'}" placeholder="请输入您的手机号码" border="none"></uv-input>
		<uv-input class='input' v-model="passwd" type="password" prefixIcon="lock" fontSize="32rpx" :prefixIconStyle="{fontSize: '40rpx'}" placeholder="请输入您的登录密码" border="none"></uv-input>
		<uv-input class='input' v-model="repasswd" type="password" prefixIcon="lock" fontSize="32rpx" :prefixIconStyle="{fontSize: '40rpx'}" placeholder="请再次输入登录密码" border="none"></uv-input>
		<view class='btn' @click="onLogin">注册</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mobile:'',
				passwd:'',
				repasswd:'',
			}
		},
		methods: {
			onLogin(){
				if(this.mobile == '') return uni.showToast({title:'请输入手机号码',icon:'none'});
				if(this.passwd == '') return uni.showToast({title:'请输入密码',icon:'none'});
				if(this.passwd != this.repasswd) return uni.showToast({title:'二次密码不一致',icon:'none'});
				var t = this;
				this.util.post('reg',{mobile:this.mobile,passwd:this.passwd},(res)=>{
					if(res.code != 1) return uni.showModal({title:'注册失败',content:res.msg,showCancel:false});
					uni.showToast({
						title:'注册成功'
					})
					setTimeout(()=>{
						uni.redirectTo({
							url:'/pages/agent/index'
						})
					},1000)
				});
			}
		}
	}
</script>

<style>
.input{
	border-bottom: 1px solid gainsboro;
	padding: 20rpx 0 !important;
}
.btn{
	background: #2A89F8;
	border-radius: 50rpx;
	font-size: 36rpx;
	color: white;
	padding: 20rpx 0;
	margin: 50rpx 0;
	text-align: center;
}
</style>
